package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (收货信息)TB_GoodsInfo
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_GoodsInfo#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_goodsInfo")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("收货信息")
@com.lianjing.sh.processing.info.annotation.InfoComment("收货信息")
public class TB_GoodsInfo
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 地址 */
		public String getAddress();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 固定地址 */
		public String getFixAddress();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_GoodsInfo properties(MustProperties properties) {
		this.setAddress(properties.getAddress());
		this.setProductOrder(properties.getProductOrder());
		this.setFixAddress(properties.getFixAddress());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_GoodsInfo(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 姓名 */
		public String getName();
		/** 电话 */
		public String getPhone();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_GoodsInfo properties(OptionalSingleProperties properties) {
		this.setName(properties.getName());
		this.setPhone(properties.getPhone());
		return this;
	}
	
	
	
	public TB_GoodsInfo(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 地址 */
		public String getAddress();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 固定地址 */
		public String getFixAddress();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_GoodsInfo properties(CurrentMustProperties properties) {
		this.setAddress(properties.getAddress());
		this.setProductOrder(properties.getProductOrder());
		this.setFixAddress(properties.getFixAddress());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 姓名 */
		public String getName();
		/** 电话 */
		public String getPhone();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_GoodsInfo properties(CurrentOptionalSingleProperties properties) {
		this.setName(properties.getName());
		this.setPhone(properties.getPhone());
		return this;
	}
	
	public TB_GoodsInfo(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_GoodsInfo(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_GoodsInfo update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_GoodsInfo.this);
			if(isOverride_getOrderValue){
				TB_GoodsInfo.this.setOrderValue(orderValue);
			}
	
			String name = getName(TB_GoodsInfo.this);
			if(isOverride_getName){
				TB_GoodsInfo.this.setName(name);
			}
	
			String address = getAddress(TB_GoodsInfo.this);
			if(isOverride_getAddress){
				TB_GoodsInfo.this.setAddress(address);
			}
	
			bairui.international.model.domain.jpa.TB_ProductOrder productOrder = getProductOrder(TB_GoodsInfo.this);
			if(isOverride_getProductOrder){
				TB_GoodsInfo.this.setProductOrder(productOrder);
			}
	
			String phone = getPhone(TB_GoodsInfo.this);
			if(isOverride_getPhone){
				TB_GoodsInfo.this.setPhone(phone);
			}
	
			String fixAddress = getFixAddress(TB_GoodsInfo.this);
			if(isOverride_getFixAddress){
				TB_GoodsInfo.this.setFixAddress(fixAddress);
			}
		}
	
		public TB_GoodsInfo up(){
			return TB_GoodsInfo.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_GoodsInfo it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 姓名 */
		private boolean isOverride_getName = true;
		public String getName(TB_GoodsInfo it) throws Exception { 
			isOverride_getName = false; 
			return null;
		}
		/** 地址 */
		private boolean isOverride_getAddress = true;
		public String getAddress(TB_GoodsInfo it) throws Exception { 
			isOverride_getAddress = false; 
			return null;
		}
		/** 产品订单 */
		private boolean isOverride_getProductOrder = true;
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder(TB_GoodsInfo it) throws Exception { 
			isOverride_getProductOrder = false; 
			return null;
		}
		/** 电话 */
		private boolean isOverride_getPhone = true;
		public String getPhone(TB_GoodsInfo it) throws Exception { 
			isOverride_getPhone = false; 
			return null;
		}
		/** 固定地址 */
		private boolean isOverride_getFixAddress = true;
		public String getFixAddress(TB_GoodsInfo it) throws Exception { 
			isOverride_getFixAddress = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_GoodsInfo() {
	}
	
	public TB_GoodsInfo(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_GoodsInfo(
		@lombok.NonNull TB_GoodsInfo bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setName(bean.getName());
		this.setAddress(bean.getAddress());
		this.setProductOrder(bean.getProductOrder());
		this.setPhone(bean.getPhone());
		this.setFixAddress(bean.getFixAddress());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("姓名")
	@com.lianjing.sh.processing.info.annotation.InfoComment("姓名")
	@javax.persistence.Column(name="name", length=30)
	private String name;

	@com.lianjing.sh.model.common.annotation.Comment("地址")
	@com.lianjing.sh.processing.info.annotation.InfoComment("地址")
	@javax.persistence.Column(name="address", nullable=false, length=255)
	private String address;

	@com.lianjing.sh.model.common.annotation.Comment("产品订单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品订单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ProductOrder productOrder;

	@com.lianjing.sh.model.common.annotation.Comment("电话")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电话")
	@javax.persistence.Column(name="phone")
	private String phone;

	@com.lianjing.sh.model.common.annotation.Comment("固定地址")
	@com.lianjing.sh.processing.info.annotation.InfoComment("固定地址")
	@javax.persistence.Column(name="fixAddress", nullable=false, length=255)
	private String fixAddress;

	/** get[姓名] */
	public String getName() {
		return this.name;
	}

	/** get[地址] */
	public String getAddress() {
		return this.address;
	}

	/** get[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder() {
		return this.productOrder;
	}

	/** get[电话] */
	public String getPhone() {
		return this.phone;
	}

	/** get[固定地址] */
	public String getFixAddress() {
		return this.fixAddress;
	}

	/** set[姓名] */
	public void setName(String name) {
		this.name = name;
	}

	/** set[地址] */
	public void setAddress(String address) {
		this.address = address;
	}

	/** set[产品订单] */
	public void setProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		this.productOrder = productOrder;
	}

	/** set[电话] */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/** set[固定地址] */
	public void setFixAddress(String fixAddress) {
		this.fixAddress = fixAddress;
	}

	public void assignProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		if(null != productOrder){
			productOrder.setGoodsInfo(this);
		}
		this.setProductOrder(productOrder);
	}
	

	
	
	

	/** take[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder takeProductOrder(){
		if(null == this.productOrder){
			this.productOrder = new bairui.international.model.domain.jpa.TB_ProductOrder();
		}
		return this.productOrder;
	}
	
	/** must[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder mustProductOrder() {
		return this.productOrder;
	}
	
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_GoodsInfo other = (TB_GoodsInfo) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		String name = this.getName();
		if(null != name){
			return String.valueOf(name);
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}



}
